// import { createStore,applyMiddleware } from 'redux';
// import createSagaMiddleware,{ END } from 'redux-saga';
// import { createLogger } from 'redux-logger';
// import rootReducer from '../reducers';

// const middlewares = [];//中间件列表
// const sagaMiddleware = createSagaMiddleware();
// middlewares.push(sagaMiddleware);

// if (__DEV__) {
//     middlewares.push(createLogger());
// }

// const initialState = {};//初始化state
// export default function configureStore(){

//     const store = createStore(
//         rootReducer,
//         initialState,
//         applyMiddleware(...middlewares)
//     );

//     store.runSaga = sagaMiddleware.run;
//     store.close = () => store.dispatch(END);
//     return store;
// }
import {createStore,applyMiddleware,compose} from 'redux'
import reducer from '../reducers/reducer'
import thunk from 'redux-thunk'//action为异步对象时：index.bundle:23975 Error: Actions must be plain objects. Use custom middleware for async actions.
// 设置调试工具
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}) : compose;
// 设置中间件
const enhancer = composeEnhancers(
  applyMiddleware(thunk)
);
const store = createStore(reducer,enhancer)//创建数据存储仓库
export default store